#include "ZContainer.h"
#pragma once
typedef struct _TrueTypeBit
{
	int len;
	int w,h,bx,by,realw;
	BYTE *Bits;
}TTrueTypeBit,*PTrueTypeBit;

namespace Zdib
{
	class CTextBase:public CContainer
	{
	public:
		CTextBase(CContainer *root,CContainer *parent,char *txt,HFONT font,TColor color);
		virtual ~CTextBase();
		void SetText(char *txt,bool iscreate=true);
		char *GetText();
		virtual void CreateTextObj();
		void SetTColor(TColor color,bool iscreate=true);
		TColor GetTColor();
		void SetHFont(HFONT font,bool iscreate=true);
		HFONT GetHFont();
		virtual void Draw();
		virtual CBitBmp *GetMyImg(){return m_Img;};
		virtual bool OnEvent(const TEvent& ev);
	protected:
		CImgFile *m_Img;
		char *m_Txt;
		wchar_t *m_WTxt;
		TZList *bitlist;
		MAT2 m_Mat2;
		TColor m_Color,m_BgColor;
		HFONT m_Font;
		HDC m_Hdc;
		int m_VSpace;
		int m_TextH;
		void ClearBitList();
	};

	class CText:public CTextBase
	{
	public:
		CText(CContainer *root,CContainer *parent,char *txt,HFONT font,TColor color);
		virtual ~CText()
		{}
	};

	class CRichText:public CTextBase
	{
	public:
		CRichText(CContainer *root,CContainer *parent,char *txt,int w,HFONT font,TColor color);
		virtual ~CRichText()
		{}
		virtual void CreateTextObj();
	private:
		int m_TextW;
		int m_HSpace;
	};
}
